package com.nchu.student_score.controller;

import com.github.pagehelper.PageInfo;
import com.nchu.student_score.model.Academy;
import com.nchu.student_score.service.AcademyService;
import com.nchu.student_score.vo.ResultVo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/academy")
public class AcademyController {
    @Resource
    AcademyService academyService;

    @RequestMapping("getAcademyList/{currPage}")
    public PageInfo<Academy> getAcademyList(@RequestBody Academy academy,@PathVariable Integer currPage){
        return academyService.getAcademyList(academy,currPage);
    }

    @RequestMapping("selectOneAcademy")
    public ResultVo<Academy> selectOneAcademy(@RequestBody Academy academy){
        return academyService.selectOneAcademy(academy);
    }

    @RequestMapping("insertOneAcademy")
    public ResultVo<Academy> insertOneAcademy(@RequestBody Academy academy){
        return academyService.insertAcademy(academy);
    }

    @RequestMapping("updateOneAcademy")
    public ResultVo<Academy> updateOneAcademy(@RequestBody Academy academy){
        return academyService.updateOneAcademy(academy);
    }

    @RequestMapping("selectAcademyCanUse")
    public ResultVo<Academy> selectAcademyCanUse(){
        return academyService.selectAcademyCanUse();
    }
}
